package com.arcaneshift.security.errors;

import com.common.security.abstracts.AbstractError;

/**
 * Error code range: 161 - 180
 * 
 * @author Ady
 *
 */
public class CardError extends AbstractError {

	public static final int NO_NAME_PROVIDED = 161;
	private static final String MESSAGE_NO_NAME_PROVIDED = "The card name was not provided";
	private static final String CAUSE_NO_NAME_PROVIDED = "The value tag was not added in the request";
	private static final String DESCRIPTION_NO_NAME_PROVIDED = "Add the value tag and try again";
	
	public static final int NO_ELEMENT_PROVIDED = 162;
	private static final String MESSAGE_NO_ELEMENT_PROVIDED = "The card element was not provided";
	private static final String CAUSE_NO_ELEMENT_PROVIDED = "The element tag was not added in the request";
	private static final String DESCRIPTION_NO_ELEMENT_PROVIDED = "Add the element tag and try again";
	
	public static final int NAME_BAD_FORMAT = 163;
	private static final String MESSAGE_NAME_BAD_FORMAT = "The name of the card was provided in a bad format";
	private static final String CAUSE_NAME_BAD_FORMAT = "The name was either too long, too short or had forbidden characters";
	private static final String DESCRIPTION_NAME_BAD_FORMAT = "Check the length and the characters used and try again";
	
	public static final int ELEMENT_NOT_EXIST = 164;
	private static final String MESSAGE_ELEMENT_NOT_EXIST = "The element does not exist in the system.";
	private static final String CAUSE_ELEMENT_NOT_EXIST = "The element was misspeled or was removed from the system.";
	private static final String DESCRIPTION_ELEMENT_NOT_EXIST = "Check your spelling and if you think it's correct, check with the administrator";
	
	public static final int CARD_TYPE_NOT_SUPPORTED = 165;
	private static final String MESSAGE_CARD_TYPE_NOT_SUPPORTED = "The provided card type is not supported";
	private static final String CAUSE_CARD_TYPE_NOT_SUPPORTED = "The card type was deleted or was never supported by the system";
	private static final String DESCRIPTION_CARD_TYPE_NOT_SUPPORTED = "Check your card type and if you think you are correct please contact the admin";
	
	public static final int CARD_NOT_FOUND = 166;
	private static final String MESSAGE_CARD_NOT_FOUND = "The card provided was not found in the database";
	private static final String CAUSE_CARD_NOT_FOUND = "The card was deleted, banned or never existed";
	private static final String DESCRIPTION_CARD_NOT_FOUND = "Check the card name and element. If you think you are right, please contact the admin.";
	
	public CardError(int code) {
		super(code);
		
		switch(code) {
			case NO_NAME_PROVIDED: {
				setMessage(MESSAGE_NO_NAME_PROVIDED);
				setCause(CAUSE_NO_NAME_PROVIDED);
				setDescription(DESCRIPTION_NO_NAME_PROVIDED);
				break;
			}
			case NO_ELEMENT_PROVIDED: {
				setMessage(MESSAGE_NO_ELEMENT_PROVIDED);
				setCause(CAUSE_NO_ELEMENT_PROVIDED);
				setDescription(DESCRIPTION_NO_ELEMENT_PROVIDED);
				break;
			}
			case NAME_BAD_FORMAT: {
				setMessage(MESSAGE_NAME_BAD_FORMAT);
				setCause(CAUSE_NAME_BAD_FORMAT);
				setDescription(DESCRIPTION_NAME_BAD_FORMAT);
			}
			case ELEMENT_NOT_EXIST: {
				setMessage(MESSAGE_ELEMENT_NOT_EXIST);
				setCause(CAUSE_ELEMENT_NOT_EXIST);
				setDescription(DESCRIPTION_ELEMENT_NOT_EXIST);
				break;
			}
			case CARD_NOT_FOUND: {
				setMessage(MESSAGE_CARD_NOT_FOUND);
				setCause(CAUSE_CARD_NOT_FOUND);
				setDescription(DESCRIPTION_CARD_NOT_FOUND);
				break;
			}
			case CARD_TYPE_NOT_SUPPORTED: {
				setMessage(MESSAGE_CARD_TYPE_NOT_SUPPORTED);
				setCause(CAUSE_CARD_TYPE_NOT_SUPPORTED);
				setDescription(DESCRIPTION_CARD_TYPE_NOT_SUPPORTED);
				break;
			}
		}
	}
}
